package com.ysl.fairy_could_class.service.impl;

import com.ysl.fairy_could_class.domain.Teacher;
import com.ysl.fairy_could_class.mapper.TeacherMapper;
import com.ysl.fairy_could_class.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    TeacherMapper mapper;
    @Override
    public List<Teacher> selectAll() {
        return mapper.selectAll();
    }
    @Override
    public Teacher selectById(int id) {
        return mapper.selectById(id);
    }
    @Override
    public int SaveTeacher(Teacher teacher) {
        return mapper.SaveTeacher(teacher);
    }
    @Override
    public int UpdateTeacher(Teacher teacher) {
        return mapper.UpdateTeacher(teacher);
    }
    @Override
    public int DeleteTeacher(int id) {
        return mapper.DeleteTeacher(id);
    }
    @Override
    public String checkTeacher(Teacher teacher) {
        int res = mapper.checkTeacher(teacher);
        if (res == 1) {
            return "登录成功";
        } else {
            return "用户名或密码错误";
        }
    }
}
